﻿using System;
using System.Collections.Generic;
using System.Text;
using Volo.Abp;

namespace mozhi.smarterp.Finance.Files
{
    public class File : AggregateRootBase<Guid>
    {
        public string FileName { private set; get; }

        public decimal FileSize { private set; get; }

        public string FileExtension { private set; get; }

        public string RemotePath { private set; get; }

        public string ContentType { private set; get; }


        public File(Guid id, string fileName, decimal fileSize, string fileExtension, string remotePath , string contentType)
        {
            Id = id;
            FileName = fileName;
            FileSize = fileSize;
            FileExtension = fileExtension;
            RemotePath = remotePath;
            ContentType = contentType;

            Validate();
        }

        #region
        private void Validate()
        {
            if (FileName.IsNullOrEmpty())
                throw new UserFriendlyException("文件名不能为空", "100000");

            if (RemotePath.IsNullOrEmpty())
                throw new UserFriendlyException("远程文件目录不能为空", "100000");
        }
        #endregion
    }
}
